﻿@page "/tutorials/dashboard"
@using Progress = BootstrapBlazor.Components.Progress

@if (Data != null)
{
    <div class="row g-3">
        <div class="col-12">
            <div class="d-flex align-items-center">
                <div class="flex-fill text-dark fw-bold me-3">Dashboard</div>
                <DateTimePicker Value="DateTimePickerValue" OnValueChanged="OnDateTimePickerValueChanged" />
            </div>
        </div>
        <div class="col-md-6 col-xl-3">
            <Card IsShadow="true">
                <BodyTemplate>
                    <div class="row align-items-center no-gutters">
                        <div class="col me-2">
                            <div class=" text-primary fw-bold mb-1"><span>全部委托数量</span></div>
                            <div class="text-dark fw-bold h5">
                                <CountUp Value="@Data.TestAllCount"></CountUp>
                            </div>
                            <div class=" text-info fw-bold mb-1"><span>全部签发数量</span></div>
                            <div class="row g-0 align-items-center">
                                <div class="col-auto">
                                    <div class="text-dark fw-bold h5 me-3 mb-0">
                                        <CountUp Value="@Data.TestApprovedAllCount"></CountUp>
                                    </div>
                                </div>
                                <div class="col"><div class="db-progress"><BootstrapBlazor.Components.Progress Value="@Data.TestApprovedAllScale" IsShowValue="true" Round="1"></BootstrapBlazor.Components.Progress></div></div>
                            </div>
                        </div>
                        <div class="col-auto"><i class="fa-regular fa-calendar-check fa-2x"></i></div>
                    </div>
                </BodyTemplate>
            </Card>
        </div>
        <div class="col-md-6 col-xl-3">
            <Card IsShadow="true">
                <BodyTemplate>
                    <div class="row align-items-center no-gutters">
                        <div class="col me-2">
                            <div class=" text-primary fw-bold mb-1"><span>今年委托数量</span></div>
                            <div class="text-dark fw-bold h5">
                                <CountUp Value="@Data.TestYearCount"></CountUp>
                            </div>
                            <div class=" text-info fw-bold mb-1"><span>今年签发数量</span></div>
                            <div class="row g-0 align-items-center">
                                <div class="col-auto">
                                    <div class="text-dark fw-bold h5 me-3 mb-0">
                                        <CountUp Value="@Data.TestApprovedYearCount"></CountUp>
                                    </div>
                                </div>
                                <div class="col"><div class="db-progress"><BootstrapBlazor.Components.Progress Value="@Data.TestApprovedYearScale" IsShowValue="true" Round="1"></BootstrapBlazor.Components.Progress></div></div>
                            </div>
                        </div>
                        <div class="col-auto"><i class="fa-regular fa-calendar-check fa-2x"></i></div>
                    </div>
                </BodyTemplate>
            </Card>
        </div>
        <div class="col-md-6 col-xl-3">
            <Card IsShadow="true">
                <BodyTemplate>
                    <div class="row align-items-center no-gutters">
                        <div class="col me-2">
                            <div class=" text-primary fw-bold mb-1"><span>本月委托数量</span></div>
                            <div class="text-dark fw-bold h5">
                                <CountUp Value="@Data.TestMonthCount"></CountUp>
                            </div>
                            <div class=" text-info fw-bold mb-1"><span>本月签发数量</span></div>
                            <div class="row g-0 align-items-center">
                                <div class="col-auto">
                                    <div class="text-dark fw-bold h5 me-3 mb-0">
                                        <CountUp Value="@Data.TestApprovedMonthCount"></CountUp>
                                    </div>
                                </div>
                                <div class="col"><div class="db-progress"><BootstrapBlazor.Components.Progress Value="@Data.TestApprovedMonthScale" IsShowValue="true" Round="1"></BootstrapBlazor.Components.Progress></div></div>
                            </div>
                        </div>
                        <div class="col-auto"><i class="fa-regular fa-calendar-check fa-2x"></i></div>
                    </div>
                </BodyTemplate>
            </Card>
        </div>
        <div class="col-md-6 col-xl-3">
            <Card IsShadow="true">
                <BodyTemplate>
                    <div class="row align-items-center no-gutters">
                        <div class="col me-2">
                            <div class=" text-primary fw-bold mb-1"><span>今日委托数量</span></div>
                            <div class="text-dark fw-bold h5">
                                <CountUp Value="@Data.TestDayCount"></CountUp>
                            </div>
                            <div class=" text-info fw-bold mb-1"><span>今日签发数量</span></div>
                            <div class="row g-0 align-items-center">
                                <div class="col-auto">
                                    <div class="text-dark fw-bold h5 me-3 mb-0">
                                        <CountUp Value="@Data.TestApprovedDayCount"></CountUp>
                                    </div>
                                </div>
                                <div class="col"><div class="db-progress"><BootstrapBlazor.Components.Progress Value="@Data.TestApprovedDayScale" IsShowValue="true" Round="1"></BootstrapBlazor.Components.Progress></div></div>
                            </div>
                        </div>
                        <div class="col-auto"><i class="fa-regular fa-calendar-check fa-2x"></i></div>
                    </div>
                </BodyTemplate>
            </Card>
        </div>
        <div class="col-md-6">
            <Card IsShadow="true" HeaderText="收样概述">
                <BodyTemplate>
                    <div class="chart-area">
                        <Chart @ref="BarChart" Height="320px" Width="auto" style="display: block; width: auto; height: 320px;"
                               ChartType="ChartType.Bar" OnInitAsync="OnInitBarChartAsync"></Chart>
                    </div>
                </BodyTemplate>
            </Card>
        </div>
        <div class="col-md-6">
            <Card IsShadow="true" HeaderText="收样分类">
                <BodyTemplate>
                    <div class="chart-area">
                        <Chart @ref="PieChart" Height="320px" Width="auto" style="display: block; width: 332px; height: 320px;"
                               ChartType="ChartType.Doughnut" OnInitAsync="@OnInitPieChartAsync"></Chart>
                    </div>
                </BodyTemplate>
            </Card>
        </div>
        <div class="col-md-6">
            <Card IsShadow="true" HeaderText="分类进度">
                <BodyTemplate>
                    <Scroll Height="320px" style="overflow:scroll;">
                        <div style="margin-right:10px;">
                            @{
                                foreach (var item in Data.TestKKSGroupList)
                                {
                                    <h4 class="small fw-bold">
                                        @item.KKS @item.NAM<span class="float-end">
                                            @(
                                            item.Percent
                                                )%
                                        </span>
                                    </h4>
                                    <BootstrapBlazor.Components.Progress Value="@item.Percent" IsAnimated="true" Color="@GetColor(item.Percent)" IsShowValue="true" Round="1"></BootstrapBlazor.Components.Progress>
                                }
                            }
                        </div>
                    </Scroll>
                </BodyTemplate>
            </Card>
        </div>
        <div class="col-md-6">
            <Card IsShadow="true" HeaderText="暂无数据">
                <BodyTemplate>
                    <Empty Image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg" Text="暂无数据"></Empty>
                </BodyTemplate>
            </Card>
        </div>
    </div>
}
